import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Serve {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(7777);
        System.out.println("服务器已创建，等待被连接......");
        List<Socket> socketList = new ArrayList<>();
        while (true){
            Socket socket = serverSocket.accept();
            socketList.add(socket);
            System.out.println(socket.getRemoteSocketAddress()+"连接成功");
            new Thread(){
                @Override
                public void run() {

                }
            }.start();
        }


    }
}
